package com.ymatou.query.trading.api.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.experimental.categories.Category;

import com.ymatou.query.trading.api.parameter.GetBuyerCouponListBean;
import com.ymatou.query.trading.api.service.GetBuyerCouponListCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.OrderCallService;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.constant.ECode;

/**
 * 获取买家的优惠券列表 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_GetBuyerCouponList {

	private static GetBuyerCouponListBean getbuyercouponlistbean;
	private static GetBuyerCouponListCall getbuyercouponlistcall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取买家的优惠券列表");
	}

	@Before
	public void caseUp() {

		getbuyercouponlistbean = new GetBuyerCouponListBean();
		getbuyercouponlistcall = new GetBuyerCouponListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getbuyercouponlistcall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	// 废弃不用
	// @Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetBuyerCouponList_001() {
		Logger.start(true,"获取买家的优惠券列表成功");
		try {
			int UserId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			// 领用优惠券
			new OrderCallService().sendCoupon(UserId);
			// 参数
			getbuyercouponlistbean.setBuyerId(UserId);
			// 发送请求
			getbuyercouponlistcall.setData(getbuyercouponlistbean);
			getbuyercouponlistcall.callService();
			Logger.comment("getbuyercouponlistcall send:" + getbuyercouponlistcall.getEntityString());
			Logger.comment("getbuyercouponlistcall response:" + getbuyercouponlistcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getbuyercouponlistcall.getCode(), "验证Code");
			Logger.verifyEquals(100, getbuyercouponlistcall.getCouponInfoList().size(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			// getbuyercouponlistcall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

}